package com.hotel.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hotel.entity.Consumption;
import com.hotel.dto.ConsumptionAddDTO;
import com.hotel.mapper.ConsumptionMapper;
import com.hotel.service.ConsumptionService;
import com.hotel.vo.ConsumptionVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class ConsumptionServiceImpl extends ServiceImpl<ConsumptionMapper, Consumption> implements ConsumptionService {

    @Autowired
    private ConsumptionMapper consumptionMapper;
    @Autowired
    private ServiceServiceImpl serviceService;

    @Override
    public void saveall(ConsumptionAddDTO consumptionAddDTO) {
        List<Consumption> consumptionList = consumptionAddDTO.getConsumptionList();
        consumptionMapper.saveall(consumptionList);
    }

    @Override
    public  List<ConsumptionVO>getConsumptionByCheckInId(Long id) {
       List<ConsumptionVO> consumptionList = consumptionMapper.getConsumptionByCheckInId(id);
        log.info("查询结果：{}", consumptionList);
        return consumptionList;
    }

}
